class Message2<T>{
    private T message ;

    public T getMessage() {
        return message;
    }
    public void setMessage(T message) {
        this.message = message;
    }
}

public class TestDemo2 {
    public static void main(String[] args) {
        Message<String> message = new Message<>() ;
        message.setMessage("不上早八！");
        func(message);

        Message<Integer> message2 = new Message<>() ;
        message2.setMessage(123);
        func(message2);
    }

    public static void func(Message<?> temp){//只接受为Message<String>的泛型，一点也不方便
        System.out.println(temp.getMessage());
    }
}
